import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.Date;

public class LocalDateTest {
    public static void main(String[] args) {
        LocalDate today = LocalDate.now();
        System.out.println("今天的日期是：" + today);
        Date currentDate = new Date();
        Instant instant = currentDate.toInstant();
        LocalDate localDate = instant.atZone(ZoneId.systemDefault()).toLocalDate();
        System.out.println("转换后的日期：" + localDate);
        // 定义两个日期
        LocalDate date1 = LocalDate.of(2024, 12, 1);
        LocalDate date2 = LocalDate.of(2024, 11, 2);

        // 计算日期差异
        long daysDiff = ChronoUnit.DAYS.between(date1, date2);

        // 输出结果
        System.out.println("两个日期之间相差的天数为：" + daysDiff);
    }
}
